package backend

import (
	"github.com/gogf/gf/v2/frame/g"
)

type RotationReq struct {
	g.Meta `path:"/backend/rotation/add" tags:"Rotation" method:"post" summary:"You first Rotation api"`
	PicUrl string `json:"pic_url" v:"required#请输入图片链接" dc:"图片链接"`
	Link   string `json:"link" v:"required#请输入跳转链接" dc:"跳转链接"`
	Sort   int    `json:"sort" dc:"排序"`
}
type RotationRes struct {
	Id uint `json:"id"`
}

type RotationDeleteReq struct {
	g.Meta `path:"/backend/rotation/delete" method:"delete" tags:"轮播图" summary:"删除轮播图接口"`
	Id     uint `v:"min:1#请选择需要删除的轮播图" dc:"轮播图id"`
}
type RotationDeleteRes struct{}

type RotationUpdateReq struct {
	g.Meta `path:"/backend/rotation/update/{Id}" method:"post" tags:"轮播图" summary:"修改轮播图接口"`
	Id     uint   `json:"id"      v:"min:1#请选择需要修改的轮播图" dc:"轮播图Id"`
	PicUrl string `json:"pic_url" dc:"修改后图片链接"`
	Link   string `json:"rotation" v:"required-without:PicUrl#图片链接和跳转链接不能同时为空"      dc:"修改后跳转链接"`
	Sort   int    `json:"sort"    dc:"排序"`
}
type RotationUpdateRes struct {
	Id uint `json:"id"`
}

type RotationGetListCommonReq struct {
	g.Meta              `path:"/backend/rotation/getList" method:"get" tags:"轮播图" summary:"获取轮播图列表接口"`
	PicUrl              string `json:"pic_url"   in:"query" dc:"图片链接"`
	Link                uint   `json:"link"   in:"query" dc:"跳转链接"`
	Sort                int    `json:"sort"   in:"query" dc:"排序(根据sort字段倒序)"`
	CommonPaginationReq        // 引用通用分页请求参数
}
type RotationGetListCommonRes struct {
	// TODO：前后端分离，不返回html，而是返回json
	// g.Meta `mime:"text/html" type:"string" example:"<html/>"`
	List  interface{} `json:"rotation_list" description:"轮播图列表"`
	Page  int         `json:"page" description:"分页码"`
	Size  int         `json:"size" description:"分页数量"`
	Total int         `json:"total" description:"数据总数"`
}
